[#include "/WEB-INF/pages/common/taglibs.ftl"]
[#--[@ckeditor.replace replace="template_editor" basePath="${base}/js/plugins/ckeditor/" initialized=false/>--]
<script type="text/javascript" src="[@c.url value='/js/plugins/ckeditor/ckeditor.js'/]"></script>
<div id="templateContent" class="template_content" >
	<a href="${action.backurl}" >返回</a>
	<form action="[@c.url value="/manage/Template_${act}.action"/]?backurl=${action.backurl}" method="post">
		<input type="hidden" name="template.id" value="${(template.id)!''}" />
		<table>
			<caption>栏目的数据内容</caption>
				<tr>
					<th>名称：[#--[@fmt.message key="manage.template"/] --]</th>
					<td>
						<input type="text" name="template.name" value="${(template.name)!''}"/>
					</td>
					<th>路径：[#--[@fmt.message key="manage.template"/] --]</th>
					<td><input readonly="readonly" type="text" name="template.path" value="${(template.path)!''}"/></td>
					<th>类型：[#--[@fmt.message key="manage.article.type"/]--]</th>
					<td>
						<select name="template.type">
							[#list typeList as type]
								<option [#if (template.type)?? && type[1] == template.type]selected="selected"[/#if]  value="${type[1]}" >${type[0]}</option>
							[/#list]
						</select>
					<th>可用：</th>
					<td colspan=2>
						<label for="" >可用</label><input type="radio" name="template.enabled" value="true" [#if template == null || (template.enabled ==true)]checked[/#if]/>
						<label for="" >禁用</label><input type="radio" name="template.enabled" value="false" [#if (template != null && template.enabled == false)]checked[/#if]/>
					</td>
				</tr>
				<tr>
					<th>模板：</th>
					<td colspan="7">
						<textarea id="template_editor" name="template.content" rows="40" >${(template.content)!''}</textarea>
					</td>
					<td>
						<div class='jqxWidget' >
							<div  class='jqxNavigationBar' style="overflow: hidden;width:270px;height:254px;">
							[#list directiveGroupModelList as group]
							    <div>自定义指令:${group.shortname} | version:${group.version}</div>
							    <div>
							    	<ul>
							    		[#list group.directiveModelList as model]
							    			<li>
							    				<a href="javascript:void(0);" namespace="${group.shortname}" directive="${model.name}" attribute="[#list model.attributeList as attribute]${attribute.name}='${attribute.defaultValue}' [/#list]" title="${model.description}">${model.name}</a>
							    				<div class="directive_descritpion" style="white-space: nowrap;display:none; width:220px;">
							    					示例:
							    					<pre>&lt@${group.shortname}_${model.name} [#list model.attributeList as attribute]${attribute.name}=&quot${attribute.defaultValue}&quot [/#list]&gt &lt@${group.shortname}_${model.name}&gt</pre>
							    				</div>
							    			</li>
							    		[/#list]
							    	</ul>
							    </div>
							[/#list]
							</div>
						</div>
					</td>
				</tr>
				<tr>
					<th></th>
					<td colspan=8><input type="submit" value="提交"/></td>
				</tr>
		</table>
	</form> 
	<script type="text/javascript">
	//<![CDATA[
		$(function(){
			var theme = getTheme();
			//默认源码模式
			var config = {
						toolbar : 'Full', 
						toolbar_Full:[
							['Source','-','Maximize', 'ShowBlocks', 'About'],
							['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
							['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak']
						], 
						enterMode:CKEDITOR.ENTER_DIV,
						entities:false
						};
						//var config = {};
			var editor = CKEDITOR.replace('template_editor', config);
			var content = CKEDITOR.instances.template_editor;
			$("a[namespace]", '.jqxWidget').click(function(){
				//var namespace = $(this).attr('namespace');
				//var directive = $(this).attr('directive');
				//var attribute = $(this).attr('attribute');
				if ($(this).next().css('display') == 'none'){
					$("a[namespace]", '.jqxWidget').next().hide("fast");
					$(this).next().show("fast");
				} else {
					$(this).next().hide("fast");
				}
			})
		})		
	//]]></script>
</div>
[@cms_article id="35" content="true"]
	${article.title}
[/@cms_article]
<div style="clear:both;"></div>
